package com.recruit.screen.core;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 *  web层通用数据处理
 */
public class BaseController {

    protected final Logger log = LoggerFactory.getLogger(this.getClass());

    //  响应成功
    public AjaxResult success(){
        return AjaxResult.success();
    }

    public AjaxResult success(String message){
        return AjaxResult.success(message);
    }

    public AjaxResult success(Object data){
        return AjaxResult.success(data);
    }

    //  响应失败
    public AjaxResult error(){
        return AjaxResult.error();
    }

    public AjaxResult error(String message){
        return AjaxResult.error(message);
    }

    public AjaxResult toAjax (boolean result){
        return result ? success() : error();
    }

    public AjaxResult toAjax (int row){
        return row > 0 ? success() : error();
    }

}
